const Koa = require('koa')
const Json = require('koa-json')
const BodyParser = require('koa-bodyparser')
const Cors = require('@koa/cors')


const app = new Koa()

app.use(Cors());
app.use(BodyParser({
    enableTypes: ['json', 'form', 'text']
}))
app.use(Json())
app.use(require('koa-static')(__dirname + '/public'))

const Router = require('./router')
app
    .use(Router.routes())
    .use(Router.allowedMethods());

app.listen(3000, function () {
    console.log('Server running http://127.0.0.1:3000/');
})